//
//  TJIdentityAuthControlller.m
//  Teleport
//
//  Created by xtjun on 2020/6/13.
//  Copyright © 2020 xtjun. All rights reserved.
//

#import "TJIdentityAuthControlller.h"
#import "TJAuthController.h"
 

@interface TJIdentityAuthControlller ()

@property (strong, nonatomic) NSArray *datas;


@end

@implementation TJIdentityAuthControlller

- (void)viewDidLoad {
    [super viewDidLoad];
    
 
       self.tableView.backgroundColor = UIColor.whiteColor;
    
       self.tableView.showsVerticalScrollIndicator = NO;
       self.tableView.rowHeight = 60;
       [self.tableView registerClass:TJStyle1Cell.self forCellReuseIdentifier:style1Cell];
       [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.offset(KNavBarHight);
           make.left.right.bottom.offset(0);
       }];
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.datas.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    TJStyle1Cell *cell = [tableView dequeueReusableCellWithIdentifier:style1Cell forIndexPath:indexPath];
    cell.model = self.datas[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
     TJCellStyleModel *model = self.datas[indexPath.row];
    TJAuthController *authController = [[TJAuthController alloc] init];
    authController.type = model.identification;
    authController.title = model.text;
    [self.navigationController pushViewController:authController animated:YES];

}

- (NSArray *)datas {
    if (!_datas) {
        NSArray *arr = @[
            @{
                @"text": @"身份证认证".localizedString,
                @"detailText": @"去认证".localizedString,
                @"identification": @"IdCard",
                @"hasArrow": @(1),
            },
            @{
                @"text": @"护照认证".localizedString,
                @"detailText": @"去认证".localizedString,
                @"identification": @"passport",
                @"hasArrow": @(1),
            }
        ];
        
        _datas = [TJCellStyleModel mj_objectArrayWithKeyValuesArray:arr];
    }
    return _datas;
    
}

@end

